﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LogManager.Base;
using Raven.Client.Indexes;

namespace LogManager.LocalStorage.Indexes
{
    public class UserIndex
    {
        public string User { get; set; }
    }

    public class Events_User : AbstractIndexCreationTask<Event,UserIndex>
    {
        public Events_User()
        {
            Map = events =>
                  from e in events
                  where e.User != null && e.User != ""
                  select new {User = e.User};
            Reduce = users =>
                     (from u in users
                      group u by u.User
                      into g
                      select new {User = g.Key});
        }
    }
}
